<template>
	<view>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">姓名:</view>
			<view class="flex7 text-left">{{info.name}}</view>
		</view>
		<cross-line class="divider"></cross-line>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">性别:</view>
			<view class="flex7 text-left">{{info.gender}}</view>
		</view>
		<cross-line class="divider"></cross-line>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">联系电话:</view>
			<view class="flex7 text-left">{{info.phone}}</view>
		</view>
		<cross-line class="divider"></cross-line>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">民族:</view>
			<view class="flex7 text-left">{{info.nation}}</view>
		</view>
		<cross-line class="divider"></cross-line>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">迁入地址:</view>
			<view class="flex7 text-left">{{info.immigrationName}}</view>
		</view>
		<cross-line class="divider"></cross-line>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">户籍地址:</view>
			<view class="flex7 text-left">{{info.huji}}</view>
		</view>
		<cross-line class="divider"></cross-line>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">迁入时间:</view>
			<view class="flex7 text-left">{{info.immigrationTime}}</view>
		</view>
		<cross-line class="divider"></cross-line>
		<view v-if="info.state == '1' && lv != 3" class="tr flex w8 text-left">
			<view class="flex3 blod">是否通过:</view>
			<view class="flex7 text-left">
				<check-box :list="isAllow" @changeCheck="changeCheck"></check-box>
			</view>
		</view>
		<cross-line v-if="info.state == `1` && lv != 3" class="divider"></cross-line>
		<view v-if="info.state == `1` && lv != 3" class="tr flex w8 text-left">
			<view class="flex3 blod">反馈意见:</view>
			<view class="flex7 text-left">
				<textarea @input="setOpin" :value="opinion" class="w10" style=" height: 200rpx; display: block;"></textarea>
			</view>
		</view>

		<view v-if="info.state == `1` && lv != 3">
			<view style="margin: 15rpx auto; width: 140rpx; height: 10rpx;">
				<butt @clickButt="submit" :bgc="bgc" content="提交"></butt>
			</view>
		</view>
	</view>
</template>
<script>
	import imgSlide from "@/components/ui/tg-img-slide.vue"
	import butt from '@/components/ui/myButt.vue'
	import slideChoice from '@/components/ui/tg-slide.vue'
	import checkBox from '@/components/ui/tg-checkbox.vue'
	import crossLine from '@/components/ui/tg-cross-line.vue'
	export default {
		components: {
			butt,
			imgSlide,
			slideChoice,
			checkBox,
			crossLine
		},
		computed: {
			linH: {
				get() {
					if (this.title.length > 18) {
						return 40
					} else {
						return 80
					}
				}
			}
		},
		props: {
			info: {

			},
			lv:{
				
			}
		},
		data() {
			return {
				opinion: '',
				isOk: false,
				title: "安徽省滁州市凤阳县府城镇府东社区委员会l栋2单—",
				bgc: '#FF6B6B',
				isAllow: [{
					content: '通过',
					check: false
				}, {
					content: '不通过',
					check: true
				}]

			}
		},
		onLoad() {},
		methods: {
			setOpin(e) {
				this.opinion = e.detail.value
			},
			changeCheck(e) {
				console.log(e)
				this.isAllow = e
				var isOk = e[1].check ? false : true
				if (isOk) {
					this.bgc = '#33B0FF'
				} else {
					this.bgc = '#FF6B6B'
				}
				this.isOk = isOk
				return isOk
				// this.changeCheck({index})
			},
			async submit() {
				var infoUser = uni.getStorageSync('info')||' '
				var data = {
					"handleOpinion": this.opinion, 
					"handleType": this.isOk?"2":"3",
					"handleUserId": infoUser.user.id,
					"processId": this.info.pid,
					"handleDepartId": infoUser.user.dept.id
				}
				console.log(data)
				var res = await this.$api.immigrationCommit(data);
				console.log(res)
				if(res.data.code == 200){
					uni.showModal({
						title:`提示`,
						content:`提交成功！`,
						success() {
							uni.navigateBack({
								
							})
						}
					})
				}else{
					uni.showModal({
						title:`提示`,
						content:`网络繁忙，请稍后重试！`,
						success() {
							uni.navigateBack({
								
							})
						}
					})
				}
			}
		}
	}
</script>
<style scoped>
	.tr {
		margin: 20rpx auto;
		font-size: 35rpx;
	}

	.divider {
		width: 600rpx;
	}
</style>
